<template>
  <div class="ccui-app-container fine-repot">
    <div class="finereport-operate-bar no-print">
      <div class="title">开发人员查询</div>
      <div class="btn-bar">
        <el-button
          size="mini"
          type="primary"
          icon="el-icon-document"
          style="float: right;"
          @click="fineExport(filePath, printOption, 'excel')"
          >导出EXCEL
        </el-button>
      </div>
    </div>
    <iframe
      class="no-print"
      id="reportFrame"
      :src="finePageUrl"
      frameborder="0"
    ></iframe>
    <div id="print-page" class="print"></div>
  </div>
</template>

<script>
import fineReport from "@/config/mixins/fineReport";
import axios from "axios";
import { addUrlPerFix } from "@/basa/utils/index";

export default {
  name: "fine-report",
  mixins: [fineReport],
  data() {
    return {
      filePath: "demo/order_demo.cpt",
      encodedFilePath: "demo%252Foder_demo.cpt",
      userId: "",
      orgId: ""
    };
  },
  created() {
    this.getCurrentInfo();
  },
  methods: {
    postSub(URL, PARAMS, target) {
      var temp_form = document.createElement("form");
      temp_form.action = URL;
      temp_form.target = target;
      temp_form.method = "post";
      temp_form.style.display = "none";
      for (var x in PARAMS) {
        var opt = document.createElement("textarea");
        opt.name = x;
        opt.value = PARAMS[x];
        temp_form.appendChild(opt);
      }
      document.body.appendChild(temp_form);
      temp_form.submit();
    },
    getCurrentInfo() {
      axios
        .post(
          addUrlPerFix(process.env.VUE_APP_BASEP_URL) +
            "/apis/basap/getUserInfo",
          {}
        )
        .then(res => {
          console.log(res);
          this.userId = res.data.userId;
          this.orgId = res.data.orgId;
        });
    }
  }
};
</script>

<style lang="scss">
@import "~@/config/styles/finereport.scss";
</style>
